#!/usr/bin/env python
"""
__init__.py

This is the initialising class. This is the start of the programme.

"""
import wxversion
wxversion.select('2.8')
import os, sys, wx
from frontend.mainWindow import FrontEnd
from settings import UserSettings

class MyApp(wx.App):
    """
    The main (wxWidget) class.
    """
    # wxWidgets calls this method to initialize the application
    def OnInit(self):
        wx.GetApp().SetAppName("athabaskan")
        settings = UserSettings.UserSettings().setState()
        currentFile = settings.lastFile()
        if len(sys.argv) >= 2:
            currentFile = sys.argv[1]
        size = settings.getWindowSize()
        position = settings.getWindowPosition()
        mainGui = FrontEnd.FrontEnd(currentFile, size, position)
        self.SetTopWindow(mainGui)
        return True

if __name__ == "__main__":
    MyApp(False).MainLoop()
